/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jpa.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author innovapps.co
 */
@Entity
@Table(name = "norma")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Norma.findAll", query = "SELECT n FROM Norma n"),
    @NamedQuery(name = "Norma.findByIdNorma", query = "SELECT n FROM Norma n WHERE n.idNorma = :idNorma"),
    @NamedQuery(name = "Norma.findByDescr", query = "SELECT n FROM Norma n WHERE n.descr = :descr"),
    @NamedQuery(name = "Norma.findByValor", query = "SELECT n FROM Norma n WHERE n.valor = :valor")})
public class Norma implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_norma")
    private Integer idNorma;
    @Basic(optional = false)
    @Column(name = "descr")
    private String descr;
    @Basic(optional = false)
    @Column(name = "valor")
    private float valor;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "normaIdNormaTraccion")
    private List<Ensayo> ensayoList;
    @OneToMany(mappedBy = "normaIdNormaFluencia")
    private List<Ensayo> ensayoList1;

    public Norma() {
    }

    public Norma(Integer idNorma) {
        this.idNorma = idNorma;
    }

    public Norma(Integer idNorma, String descr, float valor) {
        this.idNorma = idNorma;
        this.descr = descr;
        this.valor = valor;
    }

    public Integer getIdNorma() {
        return idNorma;
    }

    public void setIdNorma(Integer idNorma) {
        this.idNorma = idNorma;
    }

    public String getDescr() {
        return descr;
    }

    public void setDescr(String descr) {
        this.descr = descr;
    }

    public float getValor() {
        return valor;
    }

    public void setValor(float valor) {
        this.valor = valor;
    }

    @XmlTransient
    public List<Ensayo> getEnsayoList() {
        return ensayoList;
    }

    public void setEnsayoList(List<Ensayo> ensayoList) {
        this.ensayoList = ensayoList;
    }

    @XmlTransient
    public List<Ensayo> getEnsayoList1() {
        return ensayoList1;
    }

    public void setEnsayoList1(List<Ensayo> ensayoList1) {
        this.ensayoList1 = ensayoList1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idNorma != null ? idNorma.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Norma)) {
            return false;
        }
        Norma other = (Norma) object;
        if ((this.idNorma == null && other.idNorma != null) || (this.idNorma != null && !this.idNorma.equals(other.idNorma))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return String.valueOf(valor);
    }
    
}
